<?php
namespace TestAdmin\Controller;
use Think\Controller;

class QuizInfoController extends BaseController {

    public function index(){

       $data = M("quiz_info")->field("quiz_name")->select();
       // var_dump($data);

        $this->assign("quiz_list", $data);

        $this->display();
    }

    public function getQuizInfo()
    {
        $quiz_name =  I("quiz_name");

        $data = M("quiz_info")->where(['quiz_name'=>$quiz_name])->find();

        $this->ajaxReturn($data);

    }

    public function changeQuizInfo()
    {
        $quiz_name = I("quiz_name");

        $data['isvisible'] = I("isvisible");
        $data['quiz_pagetitle'] = I("quiz_pagetitle");
        $data['quiz_pageintroduce'] = I_withoutReplace("quiz_pageintroduce");
        $data['quiz_pagetips'] = I_withoutReplace("quiz_pagetips");

        M("quiz_info")->where(['quiz_name'=>$quiz_name])->save($data);

        $this->ajaxReturn(['msg' =>'保存成功！']);
    }



}